#pragma once
#pragma comment( lib, "ws2_32.lib" )
#include <winsock2.h>

struct Packet;

class CServerCommunication
{



public:
	void Init(LPTSTR lpCmdLine,  struct Packet * pPlayerPacket);

private:
	WSADATA wsaData;
	SOCKET hServerSocket;
	SOCKADDR_IN servAddr;
	HANDLE hSndThread, hRcvThread;
	
	WCHAR* argv[3];
	int argvSize[3];

	void ErrorHandling(char* message); 
	void ConvertCmdLine(LPTSTR lpCmdLine, WCHAR* argv[], int* size);
	void CreateServSoket();
	void ConnectServer();

	static unsigned WINAPI SendMsg(void* arg);
	static unsigned WINAPI RecvMsg(void* arg);

	static struct Packet* m_pPacket;

public:
	CServerCommunication(void);
	~CServerCommunication(void);
};

